﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Photography
{
    public partial class Gallery : System.Web.UI.Page
    {
        protected int GalleryId { get; private set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool validID = false;
            int galleryId = -1;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ID"]))
                validID = int.TryParse(Request.QueryString["ID"], out galleryId);
            if (validID)
                GalleryId = galleryId;
            else
                GalleryId = -1;
        }
        protected void GetGalleryPhotos(object sender, LinqDataSourceSelectEventArgs e)
        {
            if (GalleryId != -1)
            {
                Photography.App_Data.PhotographyDataContext context = new Photography.App_Data.PhotographyDataContext();
                e.Result = context.GetGalleryPhotos(GalleryId);
            }
        }

    }
}
